package net.alteiar.ui.editor.tools;

import java.awt.Point;

import net.alteiar.images.metadata.ImageInfo;

public abstract class ImageInfoTool {

	private final ImageInfo info;
	private final ImageInfo tmp;

	public ImageInfoTool(ImageInfo info, ImageInfo tmp) {
		this.info = info;
		this.tmp = tmp;
	}

	protected abstract void doAction(ImageInfo info, Point imgPos);

	public final void doAction(Point imgPos) {
		doAction(info, imgPos);
	}

	protected boolean canDoTmp() {
		return true;
	}

	public void doTmp(Point imgPos) {
		if (canDoTmp()) {
			tmp.fill(1);
			doAction(tmp, imgPos);
		}
	}

}
